/*
 * Copyright 2016 drakeet. https://github.com/drakeet
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.epfresh.adapter;

import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.epfresh.R;

import multitype.ItemViewBinder;


public class ViewBinderHomeBottom
    extends ItemViewBinder<Integer, ViewBinderHomeBottom.ViewHolder> {

    @NonNull @Override
    protected ViewHolder onCreateViewHolder(
        @NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {
        View view = inflater.inflate(R.layout.view_home_bottom, parent, false);
        return new ViewHolder(view);
    }


    @Override
    protected void onBindViewHolder(@NonNull ViewHolder holder, @NonNull Integer category) {
        if (category==0){
            holder.iv_most_fresh.setVisibility(View.GONE);
            holder.rl_bottom.setVisibility(View.VISIBLE);
        }else{
            holder.iv_most_fresh.setVisibility(View.VISIBLE);
            holder.rl_bottom.setVisibility(View.GONE);
        }
    }


    static class ViewHolder extends RecyclerView.ViewHolder {
        View iv_most_fresh,rl_bottom;


        ViewHolder(@NonNull View itemView) {
            super(itemView);
            iv_most_fresh = itemView.findViewById(R.id.iv_most_fresh);
            rl_bottom = itemView.findViewById(R.id.rl_bottom);
        }
    }
}
